#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@file: Engine.py
@author: lyndon
@time: Created on 2021-01-15 9:41
@env: Python
@desc:
@ref:
@blog:
"""
from sqlalchemy import create_engine, Column, Integer, String, Text, ForeignKey, Table, DateTime, SmallInteger
from sqlalchemy import create_engine
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('mysql+pymysql://foxmind:Foxmind0827!@192.168.100.1:3306/foxmind?charset=utf8')
Base = declarative_base()


class CustmGrpBasInfo(Base):
    __tablename__ = 't_custm_grp_bas_info'

    id = Column(String(36), primary_key=True)
    custm_grp_name = Column(String(100), nullable=True)
    custm_grp_desc = Column(String(1000), nullable=True)
    domain = Column(String(36), nullable=True)
    model_express = Column(String(1000), nullable=True)
    custm_grp_stat = Column(SmallInteger, nullable=True)
    audit_reasn = Column(String(500), nullable=True)
    creator = Column(String(36), nullable=True)
    created_at = Column(DateTime, nullable=True)
    updater = Column(String(36), nullable=True)
    updated_at = Column(DateTime, nullable=True)
    deleter = Column(String(36), nullable=True)
    deleted_at = Column(DateTime, nullable=True)

    def __repr__(self):
        """  这个类似java的 toString方法 """
        return '%s(%r)' % (self.__class__.__name__, self.custm_grp_name)


class CustmGrpModelInfo(Base):
    __tablename__ = 't_custm_grp_model_info'

    id = Column(String(36), primary_key=True)
    custm_grp_id = Column(String(36), nullable=True)
    model_id = Column(String(36), nullable=True)
    label_express = Column(String(1000), nullable=True)
    creator = Column(String(36), nullable=True)
    created_at = Column(DateTime, nullable=True)
    updater = Column(String(36), nullable=True)
    updated_at = Column(DateTime, nullable=True)
    deleter = Column(String(36), nullable=True)
    deleted_at = Column(DateTime, nullable=True)

    def __repr__(self):
        """  这个类似java的 toString方法 """
        return '%s(%r)' % (self.__class__.__name__, self.id)
